<ui:composition
		xmlns="http://www.w3.org/1999/xhtml"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:a4j="http://richfaces.org/a4j"
		xmlns:rich="http://richfaces.org/rich"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:itdep="http://itdep.bsuir.by/jsf"
		>

<h:panelGrid columns="1" width="100%">
<a4j:form>
	<h:outputText value="#{commonBundle.infoAboutStudyCourse}" styleClass="requiredField"/>
	<br/>
	<a4j:form>
		<h:panelGrid id="eventPanelGrid">
			<a4j:form>
				<a4j:commandLink value="#{commonBundle.transfer}"
								 action="#{studentBean.transfer}"
								 reRender="eventPanelGrid"
								 rendered="#{studentBean.showTransferLink}"
								 immediate="true"/>
				<br/>
				<a4j:commandLink value="#{commonBundle.vacation}"
								 action="#{studentBean.goVacation}"
								 reRender="eventPanelGrid"
								 rendered="#{studentBean.showVacationLink}"
								 immediate="true"/>
				<br/>
				<a4j:commandLink value="#{commonBundle.deleteLastAddEvent}"
								 immediate="true"/>
			</a4j:form>
		</h:panelGrid>
	</a4j:form>
	<br/>
	<rich:dataTable id="eventTable" width="100%" headerClass="dr-table-header"
					onRowMouseOver="this.style.backgroundColor='#f1f1f1';"
					onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}';"
					var="record" value="#{studentEventBean.dataModel}"
					binding="#{studentEventBean.tableBinding}">
		<rich:column>
			<f:facet name="header"><h:outputText value="#{studentBundle.directiveType}"/></f:facet>
			<itdep:entityOutput value="#{record.directive.directiveType}"
								format="{i18n.description}"
								locale="#{translationBean.locale}"/>
		</rich:column>
		<rich:column>
			<f:facet name="header"><h:outputText value="#{studentBundle.numDirective}"/></f:facet>
			<h:outputText value="#{record.directive.directiveNumber}"/>
		</rich:column>
		<rich:column>
			<f:facet name="header"><h:outputText value="#{studentBundle.dateDirective}"/></f:facet>
			<h:outputText value="#{record.directive.directiveDate}">
				<f:convertDateTime pattern="dd.MM.yyyy" timeZone="EET"/>
			</h:outputText>
		</rich:column>
		<ui:decorate template="/facelets/template/student/columnStudentGroup.xhtml">
			<ui:param name="record" value="#{record.oldStudentGroup}"/>
		</ui:decorate>
		<rich:column>
			<f:facet name="header"><h:outputText value="#{dictionaryBundle.eventReason}"/></f:facet>
			<itdep:entityOutput value="#{record.eventReason}"
								format="{i18n.description}"
								locale="#{translationBean.locale}"/>
		</rich:column>
		<rich:column>
			<f:facet name="header">
				<h:outputText value="#{commonBundle.action}"/>
			</f:facet>
			<a4j:commandLink ajaxSingle="true" id="editlink" action="#{studentEventBean.edit}"
							 oncomplete="#{rich:component('editPanel')}.show()">
				<h:graphicImage value="/img/edit.gif" style="border:0"/>
			</a4j:commandLink>
			<rich:toolTip for="editlink" value="#{commonBundle.edit}"/>
			<a4j:commandLink ajaxSingle="true" id="dellink" rendered="#{studentEventBean.allTable}">
				<h:graphicImage value="/img/delete.gif" style="border:0"/>
			</a4j:commandLink>
			<rich:toolTip for="dellink" value="#{commonBundle.delete}"/>
		</rich:column>
	</rich:dataTable>
	<br/>
	<br/>
	<h:outputText value="#{commonBundle.transferFromFuculty}" styleClass="requiredField"/>
	<br/>
	<br/>
	<rich:dataTable id="eventTransferTable" width="100%" headerClass="dr-table-header"
					onRowMouseOver="this.style.backgroundColor='#f1f1f1';"
					onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}';"
					var="record" value="#{studentEventBean.transEvent}" rowKeyVar="row">
		<rich:column>
			<f:facet name="header"><h:outputText value="#{studentBundle.directiveType}"/></f:facet>
			<itdep:entityOutput value="#{record.directive.directiveType}"
								format="{i18n.description}"
								locale="#{translationBean.locale}"/>
		</rich:column>
		<rich:column>
			<f:facet name="header"><h:outputText value="#{studentBundle.numDirective}"/></f:facet>
			<h:outputText value="#{record.directive.directiveNumber}"/>
		</rich:column>
		<rich:column>
			<f:facet name="header"><h:outputText value="#{studentBundle.dateDirective}"/></f:facet>
			<h:outputText value="#{record.directive.directiveDate}">
				<f:convertDateTime pattern="dd.MM.yyyy" timeZone="EET"/>
			</h:outputText>
		</rich:column>
		<rich:column>
			<f:facet name="header"><h:outputText value="#{commonBundle.transferredFrom}"/></f:facet>
			<h:panelGroup id="infoOldGr">
				<h:outputText value="#{studentBundle.group}: "/>
				<itdep:entityOutput value="#{record.oldStudentGroup}"
									format="{i18n.description}"
									locale="#{translationBean.locale}"/>
				<rich:spacer width="5"/>
				<h:outputText value="#{record.oldStudentGroup.course} "/>
				<h:outputText value="#{studentBundle.course}"/>
			</h:panelGroup>
		</rich:column>
		<rich:column>
			<f:facet name="header"><h:outputText value="#{commonBundle.transferredTo}"/></f:facet>
			<h:outputText value="#{studentBundle.group}: "/>
			<itdep:entityOutput value="#{record.student.studentGroup}"
								format="{i18n.description}"
								locale="#{translationBean.locale}"/>
			<rich:spacer width="5"/>
			<h:outputText value="#{record.student.studentGroup.course} "/>
			<h:outputText value="#{studentBundle.course}"/>
		</rich:column>
		<rich:column>
			<f:facet name="header"><h:outputText value="#{dictionaryBundle.eventReason}"/></f:facet>
			<itdep:entityOutput value="#{record.eventReason}"
								format="{i18n.description}"
								locale="#{translationBean.locale}"/>
		</rich:column>
		<rich:column>
			<f:facet name="header">
				<h:outputText value="#{commonBundle.action}"/>
			</f:facet>
			<a4j:commandLink ajaxSingle="true" id="editTransfLink"
							 oncomplete="#{rich:component('editEventModPanel')}.show()">
				<h:graphicImage value="/img/edit.gif" style="border:0"/>
				<f:setPropertyActionListener value="#{record}"
											 target="#{studentEventBean.currentItem}"/>
			</a4j:commandLink>
			<rich:toolTip for="editlink" value="#{commonBundle.edit}"/>
			<a4j:commandLink ajaxSingle="true" id="delTranslink" rendered="#{studentEventBean.transTable}">
				<h:graphicImage value="/img/delete.gif" style="border:0"/>
			</a4j:commandLink>
			<rich:toolTip for="delTranslink" value="#{commonBundle.delete}"/>
		</rich:column>
	</rich:dataTable>
	<br/>
	<br/>
	<h:outputText value="#{commonBundle.vacationStud}" styleClass="requiredField"/>
	<br/>
	<br/>
	<rich:dataTable id="eventVacationTable" width="100%" headerClass="dr-table-header"
					onRowMouseOver="this.style.backgroundColor='#f1f1f1';"
					onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}';"
					var="record" value="#{studentEventBean.vacationEvent}">
		<rich:column>
			<f:facet name="header"><h:outputText value="#{studentBundle.numDirective}"/></f:facet>
			<h:outputText value="#{record.directive.directiveNumber}"/>
		</rich:column>
		<rich:column>
			<f:facet name="header"><h:outputText value="#{studentBundle.dateDirective}"/></f:facet>
			<h:outputText value="#{record.directive.directiveDate}">
				<f:convertDateTime pattern="dd.MM.yyyy" timeZone="EET"/>
			</h:outputText>
		</rich:column>
		<ui:decorate template="/facelets/template/student/columnStudentGroup.xhtml">
			<ui:param name="record" value="#{record.student.studentGroup}"/>
		</ui:decorate>
		<rich:column>
			<f:facet name="header"><h:outputText value="#{commonBundle.period}"/></f:facet>
			<h:outputText value="#{record.startVacation}">
				<f:convertDateTime pattern="dd.MM.yyyy" timeZone="EET"/>
			</h:outputText>
			<h:outputText value="-"/>
			<h:outputText value="#{record.finnishVacation}">
				<f:convertDateTime pattern="dd.MM.yyyy" timeZone="EET"/>
			</h:outputText>
		</rich:column>
		<rich:column>
			<f:facet name="header"><h:outputText value="#{dictionaryBundle.eventReason}"/></f:facet>
			<itdep:entityOutput value="#{record.eventReason}"
								format="{i18n.description}"
								locale="#{translationBean.locale}"/>
		</rich:column>
		<rich:column>
			<f:facet name="header">
				<h:outputText value="#{commonBundle.action}"/>
			</f:facet>
			<a4j:commandLink ajaxSingle="true" id="editVacationLink"
							 oncomplete="#{rich:component('editEventModPanel')}.show()">
				<h:graphicImage value="/img/edit.gif" style="border:0"/>
				<f:setPropertyActionListener value="#{record}"
											 target="#{studentEventBean.currentItem}"/>
			</a4j:commandLink>
			<rich:toolTip for="editlink" value="#{commonBundle.edit}"/>
			<a4j:commandLink ajaxSingle="true" id="delVaclink" rendered="#{studentEventBean.vacationTable}">
				<h:graphicImage value="/img/delete.gif" style="border:0"/>
			</a4j:commandLink>
			<rich:toolTip for="delVaclink" value="#{commonBundle.delete}"/>
		</rich:column>
	</rich:dataTable>
</a4j:form>
<ui:decorate template="/facelets/template/student/event/editPanelEventTemplate.xhtml"/>
<rich:modalPanel id="editPanel" autosized="true" width="450">
	<f:facet name="header">
		<h:outputText value="Edit Current Directive"/>
	</f:facet>
	<f:facet name="controls">
		<h:panelGroup>
			<h:graphicImage value="/img/close.png" id="hidelink"
							styleClass="hidelink"/>
			<rich:componentControl for="editPanel" attachTo="hidelink"
								   operation="hide" event="onclick"/>
		</h:panelGroup>
	</f:facet>
	<h:form>
		<h:panelGrid columns="1">
			<a4j:outputPanel ajaxRendered="true">
				<ui:decorate template="/facelets/template/student/eventReasonTemplate.xhtml">
					<ui:param name="idPrefix" value="editDir"/>
					<ui:param name="event" value="#{studentEventBean.record}"/>
				</ui:decorate>
			</a4j:outputPanel>
			<a4j:commandButton id="butSave" value="#{commonBundle.save}"
							   action="#{studentEventBean.saveDirEvent}"
							   reRender="eventTable"/>
			<rich:componentControl for="editPanel" attachTo="butSave"
								   operation="hide" event="onclick"/>
		</h:panelGrid>
	</h:form>
</rich:modalPanel>
</h:panelGrid>
</ui:composition>